package service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import dao.DishDao;
import po.Dish;
import service.DishService;
import util.Po2Vo;
import vo.DishVo;

@Service("dishService")
public class DishServiceImpl implements DishService {

	@Autowired
	private DishDao dishDao;
	
	@Override
	@Transactional
	public List<DishVo> getAdDish(List<String> didList) {
		List<Dish> dishList = dishDao.getAdDish(didList);
		List<DishVo> dishVoList = new ArrayList<DishVo>();
		for(Dish d : dishList){
			dishVoList.add(Po2Vo.dishPo2Vo(d, 0));
		}
		return dishVoList;
	}

	@Override
	public Dish findDishByDid(String did) {
		
		return dishDao.findDishByDid(did);
	}

}
